package com.k.demo.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.k.demo.entity.ShoppingCartDetail;
import com.k.demo.mapper.FoodMapper;
import com.k.demo.mapper.ShoppingCartDetailMapper;
import com.k.demo.service.ShoppingCartDetailService;

@Service
public class ShoppingCartDetailServiceImpl implements ShoppingCartDetailService{

	@Autowired
	private ShoppingCartDetailMapper shoppingCartDetailMapper;
	
	public ShoppingCartDetail selectByIdAndAttach(int shopping_cart_id,int food_id,String detail_attach) {
		return shoppingCartDetailMapper.selectByIdAndAttach(shopping_cart_id, food_id, detail_attach);
	}
	
	public int insertShoppingCartDetail(ShoppingCartDetail shoppingCartDetail) {
		return shoppingCartDetailMapper.insertShoppingCartDetail(shoppingCartDetail);
	}
	
	public int updateShoppingCartDetail(ShoppingCartDetail shoppingCartDetail) {
		return shoppingCartDetailMapper.updateShoppingCartDetail(shoppingCartDetail);
	}

	@Override
	public boolean deleteShoppingDetail(int detailID) {
		
		return shoppingCartDetailMapper.deleteShoppingDetail(detailID)>0;
	}

	@Override
	public ShoppingCartDetail selectByDetailID(int cartID,int foodID,String detail_attach) {
		
		return shoppingCartDetailMapper.selectDetail(cartID, foodID, detail_attach);
	}

	@Override
	public boolean deleteDetail(ShoppingCartDetail shoppingCartDetail) {
		
		return shoppingCartDetailMapper.deleteDetail(shoppingCartDetail)>0;
	}

	public boolean deleteShoppingDetailIn(List<Integer> list) {
		return shoppingCartDetailMapper.deleteShoppingDetailIn(list);

	}
}
